package com.youxin.busfoundation.common.qiniu;

import com.youxin.foundation.utils.StringUtils;

/**
 * 七牛云配置
 * @author yingde.cao
 * @date 2017年12月7日
 * @version 1.0
 */
public enum QiniuBucketType {
	/**
	 * 委托文件上传
	 */
	CpDelegate("cp-delegate","http://p02fn3e40.bkt.clouddn.com/"),
	/**
	 * 营业执照
	 */
	CpBusinessLicense("cp-business-license","http://p0lly70nv.bkt.clouddn.com/"),
	/**
	 * 身份证上传
	 */
	CpIdCard("cp-id-card","http://p0llgnlec.bkt.clouddn.com/"),
	/**
	 * 微信支付二维码
	 */
	CpWxPayQrCode("cp-weixin-pay-qrcode","http://p15hg2ebd.bkt.clouddn.com/")
	;
	
	private String name,url;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	private QiniuBucketType(String name,String url) {
		this.url=url;
		this.name=name;		
	}
	
	public static QiniuBucketType nameOf(String val)
	{			
		if(StringUtils.isNullOrEmpty(val))
		{
			return null;
		}
		for(QiniuBucketType m : QiniuBucketType.values()) 
		{
			if(val.equalsIgnoreCase(m.name())){
				return m;
			}
	    }
		return null;
	}
}
